Skip to content

feature: export options types and renderHook result type #1091

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Sep 6, 2022

Conversation

mdjastrzebski
Copy link
Member

Resubmitting #1034 as almost done but have to write access to forked PR-repo and OP @evanwalsh is not responsive.

Original description below:

Summary

While writing helpers around the render and renderHook functions, I found myself wanting/needing the types for the options and the returns. This explicitly exports those types that weren't already exposed to avoid having to do something like the following:

type RenderOptions = Parameters<typeof render>[1]
type RenderHookOptions = Parameters<typeof renderHook>[1]

// Copied/pasted from @testing-library/react-native
interface RenderHookResult<Result, Props> {
  result: {current: Result}
  rerender: (props: Props) => void
  unmount: () => void
}

These types are already documented, so this just fully exposes types that are already meant for users.

Test plan

I'm not sure what additional tests would be needed for this. As long as type checking succeeds, these changes should be good.

@mdjastrzebski mdjastrzebski force-pushed the feature/export-render-types branch from 223746e to 3c652c7 Compare September 2, 2022 11:14
@mdjastrzebski mdjastrzebski merged commit 2c096ff into main Sep 6, 2022
@mdjastrzebski mdjastrzebski deleted the feature/export-render-types branch September 6, 2022 10:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants